package sk.lieskove.jianghongtiao.websearch.api.google.search;

import java.util.HashMap;
import java.util.Map;

/**
 * The Enum ImageSize.
 */
public enum GWSLanguage  {
	
	Arabic ("ar"),
	Bulgarian ("bg"),
	Catalan ("ca"),
	Chinese_Simplified ("zh-CN"),
	Chinese_Traditional ("zh-TW"),
	Croation ("hr"),
	Czech ("cs"),
	Danish ("da"),
	Dutch ("nl"),
	English ("en"),
	Estonian ("et"),
	Finnish ("fi"),
	French ("fr"),
	German ("de"),
	Greek ("el"),
	Hebrew ("iw"),
	Hungarian ("hu"),
	Icelandic ("is"),
	Indonesian ("id"),
	Italian ("it"),
	Japanese ("ja"),
	Korean ("ko"),
	Latvian ("lv"),
	Lithuanian ("lt"),
	Norwegian ("no"),
	Polish ("pl"),
	Portuguese ("pt"),
	Romanian ("ro"),
	Russian ("ru"),
	Serbian ("sr"),
	Slovak ("sk"),
	Slovenian ("sl"),
	Spanish ("es"),
	Swedish ("sv"),
	Turkish ("tr");
	
    /** The Constant stringToEnum. */
	private static final Map<String, GWSLanguage> stringToEnum = new HashMap<String, GWSLanguage>();

	static { // Initialize map from constant name to enum constant
		for (GWSLanguage op : values()) {
			stringToEnum.put(op.value(), op);
		}
	}
	
    /** The value. */
    private final String value;
    
    /**
     * Instantiates a new image size.
     * 
     * @param value the value
     */
    GWSLanguage(String value) {
        this.value = value;
    }

	public String value() {
		return value;
	}
    
    public static GWSLanguage fromCode(String code){
        for (GWSLanguage gWSLanguage : values()) {
            if(gWSLanguage.value().equals(code)){
                return gWSLanguage;
            }
        }
        return null;
    }
	
	/**
	 * From value.
	 * 
	 * @param value the value
	 * 
	 * @return the image size
	 */
	public static GWSLanguage fromValue(String value) {
		return stringToEnum.get(value);
	}

}
